﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Pay
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_KeyUp(object sender, KeyEventArgs e)
        {
            if(e.KeyCode == Keys.F2)
            {
                txtGoodsCode.Focus();
            }
        }
        private GoodsManager gm = new GoodsManager();
        private List<BuyGoodsInfo> buyList = new List<BuyGoodsInfo>();
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (txtGoodsCode.Text != "")
            {
                List<GoodsInfo> list = gm.GetListByCode(txtGoodsCode.Text);
                if (list.Count == 0)
                {
                    MessageBox.Show("商品编号输入错误");
                }
                else if (list.Count == 1)
                {

                }
                else
                {

                }
                txtGoodsCode.Text = "";
            }
        }
        private void txtGoodsCode_KeyUp(object sender, KeyEventArgs e)
        {
            if(e.KeyCode ==Keys.Enter)
            {
                if(txtGoodsCode.Text != "")
                {
                    btnSearch_Click(null,null);
                }
            }
        }

    }
}
